/**
 * 广告模型
 * @props priority       优先级
 * @props show           是否展示
 * @props imgUrl         banner图片地址
 * @props jumpUrl        跳转地址
 * @props jumpParams     跳转参数
 * @props des            描述信息
 * @props background     背景颜色
 */
export default function (app) {
  const { STRING, INTEGER, DATE, BOOLEAN, JSONB } = app.Sequelize;
  const Banner = app.model.define('banner', {
    priority: INTEGER,
    show: { type: BOOLEAN, defaultValue: false },
    imgUrl: { type: STRING, allowNull: false },
    jumpUrl: { type: STRING, allowNull: false },
    jumpParams: { type: JSONB },
    background: STRING,
    des: STRING,
    createdAt: DATE,
    updatedAt: DATE
  });

  return Banner;
}
